Gender is a term of grammer.
Gender is a term of grammar.
Strictly speaking, gender is a grammatical category, and sex is a biological category. But who the hell speaks strictly or accurately these days?