noun which may take the genitive case particle 'no'
grammatical
Used as a no-adjective to modify nouns, meaning 'relating to grammar' or 'in terms of grammar'.
This sentence has a grammatical error.
grammatically
Adverbial use, often with に or as a standalone adverb, meaning 'from a grammatical standpoint'.
Grammatically, this expression is incorrect.
Compound of 文法 (grammar) and 上 (in terms of, from the viewpoint of).