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.
adverb
grammatically
Adverbial use, often with に or as a standalone adverb, meaning 'from a grammatical standpoint'.
文法上、この表現は正しくない。
Grammatically, this expression is incorrect.