It is true that gender is a term used for the grammatical response to the sex of animate beings and the animation status of things in general. However, it is also currently used for sex as a social construct as opposed to sex as a biological fact. Thus, the term "gender" is used in this manner when a distinction is made between cis-gendered heterosexual males and cis-gendered heterosexual females on the one hand, and gays and the trans-gendered on the other.
Notice how an antonym of transgendered was formed by borrowing the cis- prefix from chemistry. Of course, this isn't totally unproblematic, I suppose, since we're becoming accustomed these days to the mantra "cis- fats good, trans- fats bad".