In linguistics, grammar is the
set of structural rules that governs the composition of clauses, phrases, and words in any given natural language. The term refers also to the study of such rules, and this field includes morphology, syntax, and phonology, often complemented by phonetics, semantics, and pragmatics. Linguists do
not normally use the term to refer to orthographical rules, although usage books and style guides that call themselves grammars may also refer to spelling and punctuation.
http://en.wikipedia.org/wiki/GrammarWell you are right, grammar is not only about the structure of the language. But I never learned it was also about spelling and the term of grammar is not used by everyone for spelling.