Grammar itself is a set of rules for using language. I think you may be referring to the ability and desire to use grammar correctly which might be genetic. When it goes beyond proper usage and extends to nitpicking and correcting others' grammar without being asked, it is defined as a mental disorder.