” Grammars evolve through usage and also due to separations of the human population. With the advent of written representations, formal rules about language usage tend to appear also. Formal grammars are codifications of usage that are developed by repeated documentation over time, and by observation as well. As the rules become established and developed, the prescriptive concept of grammatical correctness can arise. This often creates a discrepancy between contemporary usage and that which has been accepted, over time, as being correct. Linguists tend to view prescriptive grammars as having little justification beyond their authors’ aesthetic tastes, although style guides may give useful advice about standard language employment, based on descriptions of usage in contemporary writings of the same language. Linguistic prescriptions also form part of the explanation for variation in speech, particularly variation in the speech of an individual speaker (an explanation, for example, for why some people say “I didn’t do nothing”, some say “I didn’t do anything”, and some say one or the other depending on social context).
The formal study of grammar is an important part of education for children from a young age through advanced learning, though the rules taught in schools are not a “grammar” in the sense most linguists use the term, particularly as they are often prescriptive rather than descriptive.” https://en.wikipedia.org/wiki/Grammar