All animals, humans included, have evolved the capacity to create a distinction between members of the in-group and those in the out-group. But the features that are selected are not set in the genome. Rather, it is open to experience.
For example, we know from studies of child development that within the first year of life, babies prefer to look at faces from their own race to faces of a different race, prefer to listen to speakers of their native language over foreigners, and even within their native language prefer to listen to their own dialect. But if babies watch someone of another race speaking their native language, they are much more willing to engage with this person than someone of the same race speaking a different language.
These social categories are created by experience, and some features are more important than others because they are harder to fake and more indicative of a shared cultural background. But, importantly, they are plastic. Racial discrimination is greatly reduced among children of mixed-racial parents. And adults who have dated individuals of another race are also much less prejudiced. On this note, moral education can play a more nurturing role by introducing all children, early in life, to the varieties of religions, political systems, languages, social organisations and races. Exposure to diversity is perhaps our best option for reducing, if not eradicating, strong out-group biases.
Marc D. Hauser