Is it appropriate?
Solution 1:
With synonyms of dink [slang], dork [slang], geek, grind, nerd, swot, weenie, wonk M. Webster Dictionary and a sense of worms that actually eat books, one could very well think of bookworm as derogatory. Even the OED says:
A person who enjoys or is devoted to reading. Frequently somewhat depreciative.
So it all depends on the context and the intent of the writer. My sense is it is neutral! I have no knowledge of grammar worm.
Solution 2:
Appreciative or neutral. I think it would be unusual to use it as an insult, though not impossible.
"Grammar worm" is not an established phrase, as far as I know, and does not have a conventional meaning. If somebody used it, you could only tell from context what they meant by it, and whether it was derogatory or not.