Gríma was secretly in thrall to Saruman, and worked to weaken Théoden and his kingdom. Upon Gandalf's arrival, "many things which men had missed" were found locked in his trunk and he was given a grim choice: ride into battle or into exile. Choosing the latter, he went to dwell with Saruman at Orthanc. Saruman had cause to regret this when, following the confrontation between Saruman and Gandalf, he mistakenly threw a "heavy rock"—which was actually the palantír of Orthanc—at the Rohirrim accompanying Gandalf, an act for which Saruman seems to have punished him severely.
He then accompanied Saruman to the Shire, where the two sought revenge in petty tyranny over the hobbits (though Saruman had already been exerting control from afar by sending evil Men to the Shire). During this time he became increasingly degraded until he was a crawling wretch, almost resembling Gollum, and Saruman shortened his nickname to "Worm". During this time he killed Lotho Sackville-Baggins, and may have eaten him.
Spurred by the words of Frodo that he did not have to follow Saruman, and being pushed over the edge when Saruman scorned him, he used a hidden knife to slit the throat of Saruman and darted down the road. He was quickly killed by several Hobbit arrows.
In Peter Jackson's Lord of the Rings films, Gríma is played by Brad Dourif. The reason for Gríma's pale and emaciated appearance in the movie is not entirely clear. Perhaps it is meant to suggest that by throwing in his lot with Saruman he has started down the same path to physical and mental corruption that caused Gollum to become a twisted parody of his original self, although it is just as likely that Jackson simply wanted to make it clear that Wormtongue was one of the "bad guys" in the large and confusing cast of characters.
The "Scouring of the Shire" episode does not appear in the film version, so Saruman's death has been moved to an earlier scene, The Voice of Saruman. Other than the location, the manner of their deaths is very much the same. As in the book, Gríma kills Saruman, but by stabbing him in the back, not slitting his throat. Saruman's body then falls from the tower and is impaled on a spiked wheel, a remnant of his war machine. Gríma himself is shot by an arrow fired by Legolas, thereby mirroring his death in the book. This scene was to have included a line where Saruman blamed Gríma for killing Théodred, replacing Lotho in the context of that scene, but the line was cut out.