The literary device used in this part of the novel Speak is called a simile. A simile is a comparison between two unlike things (people, places, events, sensations, etc). Unlike a metaphor, which also compares two unlike things, a simile does so using the words "like" or "as."
Some examples of similes:
"Her heart expanded like an exploding star when she saw her boyfriend rescue the puppy from the tree."
"The squat pen rests, snug as a gun" This one is from Seamus Heaney's excellent poem "Digging")
Authors use similes, and other figurative language, to bring their writing to life and help readers feel immersed in the story. Similes and metaphors in particular can have two opposing functions: to make a new and strange thing more familiar to the audience and to provide a new or strange viewpoint on a familiar or cliche thing.