The OED tells us that
In the Middle Ages, grammatica and its Rom[ance] forms chiefly meant the knowledge or study of Latin, and were hence often used as synonymous with learning in general, the knowledge peculiar to the learned class. As this was popularly supposed to include magic and astrology, the OF. gramaire was sometimes used as a name for these occult sciences. In these applications it still survives in certain corrupt forms, F. grimoire, Eng. GLAMOUR
So both glamour, which originally meant "magic, enchantment, spell", and grimoire, a manual for summoning demons, used to be the same word as grammar.
There seems to be a similar language/magic association with the word spell.
In Proto-Germanic *gerbʰ- became *kraƀiz-, then Old High German kerbiz "edible crustacean". The "scratch" meaning was extended to crustaceans, because they move by scratching the ground. This was borrowed into Old French as crevice, then borrowed into Middle English as crevise, which was folk etymologized to crayfish and crawfish. Crab is probably from the same Proto-Germanic word.
Some older posts on grammar:
Last year I asked what is grammar, anyway?
The grammar of the Maple Leafs.
What's up with between you and I?
Using that or which in relative clauses.
Conditional clauses: if it was or if it were.
And check out Motivated Grammar's Ten More Common Grammar Myths, Debunked.