GNASH means to bite your teeth together and grind them around.
GRIT means to bite your teeth together very hard and keep your jaw still.
GNASH is usually used to describe a person who is angry and looks angry:
John gnashed his teeth when he saw the mess his dog had made.
GRIT is very slightly different.
GRIT is used to describe a person who is angry, but trying very hard not to look angry.
John grit his teeth together when the teacher gave him 6 books to read for homework.
[The word GRIT can also be a noun. It means rough dirt, such as sand. Sometimes you may hear the slang: "John has grit." This would mean that John is steady in his personality, and perhaps brave. He does what must be done and does not complain]