Gender is a sociological construct, associated with how one identifies oneself. Sex is the chromosomal, biological and genital nature of a being. Luckily for most of us, the two are usually in congruence, i.e. identifying as a woman whilst being in possession of XX genotype and female genitalia. Life is significantly harder for those individuals with unusual genotypes, atypical genitalia or identifying themselves as a different gender.
I get really irritated with the 'gender scan', both as it is incorrect terminology, and due to the fact that the 20 wk scan is primarily about detection of anomalies.