The ternary semiconductors Cu2SnX3 (X=S, Se) are found frequently as secondary phases in synthesized Cu2ZnSnS4 and Cu2ZnSnSe4 samples, but previous reports on their crystal structures and electronic band gaps are conflicting. Here we report their structural and electronic properties as calculated using a first-principles approach. We find that: (i) the diverse range of crystal structures such as the monoclinic, cubic and tetragonal phases can all be derived from the zinc-blende structure with tetrahedral coordination. (ii) The energy stability of different structures is determined primarily by the local cation coordination around anions, which can be explained by a generalized valence octet rule. Structures with only Cu3Sn and Cu2Sn2 clusters around the anions have low and nearly degenerate energies, which makes Cu and Sn partially disordered in the cation sublattice. (iii) The direct band gaps of the low energy compounds Cu2SnS3 and Cu2SnSe3 should be in the range of 0.8-0.9 eV and 0.4 eV respectively, and are weakly dependent on the long-range structural order. A direct analogy is drawn with the ordered vacancy compounds found in the Cu(In, Ga)Se2 (CIGS) solar cell absorbers.