Raising its head could be defense, but it could also be to get a better view. Snakes use their forked tongues to "sniff" (not a technical explanation, I know), and the air currents are probably a little better a few inches off the ground.
Colubrids (such as garter snakes and brown snakes) have fairly good vision as well, but I've always wondered how much they can see. I mean, how much room is there in a snake's head for information processing? How big are their brains?