taken from here:
http://www.ratbehavior.org/WhatIsMyRatDoingFAQ.htm
Rats grind their front teeth together producing a grinding sound called bruxing or chattering. Rats probably grind their teeth together to wear them down (a process called thegosis). A rat's incisors grow continuously. This constant growth enables rats to spend their lives gnawing on things without wearing their teeth down to the gum. But it also means that rats must use their teeth continually to keep them from growing too long, hence the tooth grinding.
Rats grind their teeth in times of stress. For example, a pet rat may grind its teeth at the vet's office, or during a tense interaction with another rat, or when the rat experiences pain. Anecdotally, rats may also grind their teeth when they are relaxed, rather like purring in a cat.
boggling:
Sometimes, a rat's eyes may vibrate rapidly in and out of the eye socket, a phenomenon called eye boggling. This odd eyeball movement often occurs at the same time as bruxing, or tooth grinding. The reason bruxing and eye boggling occur together is anatomical: a part of the muscle that pulls up the rat's lower jaw passes through the eye socket, behind the eyeball. When a rat grinds its teeth, it moves its lower jaw rapidly up and down, and the contractions of the jaw muscle vibrate the eyeball in and out of the socket in time with the jaw.
Eye boggling is associated with intense bruxing. Anecdotally, eye boggling occurs at times of great contentment and relaxation.