The exact mechanism behind the strange blood-squirting
behavior is not completely well understood. Some scientists
believe that there are special chambers in the head of the horned
lizard which the lizard naturally fills with blood at the beginning of
each day. Because the horned lizard is a cold-blooded reptile living in
a desert environment that often reaches intensely cold temperatures
during the night, the horned lizard uses these chambers to warm its
blood before beginning its daily activities. The lizard spends the
night burrowed in the sand, and heats the blood in these chambers by
sticking its head out of the sand in the morning to absorb heat from
the sun. According to this theory, when threatened, the horned lizard
fills these chambers so rapidly that they burst and the blood spills
out of special ducts in the lizard's eyes.
A more complicated and specific explanation is that the blood originates from the large sinus orbitalis, which occupies the space between the eyeball and orbital walls and surrounds the lacrimal and harderian glands. These hormonal glands could be the source of the noxious chemical that is mixed into the blood, causing it to have a foul odor and taste. When threatened, a specialized muscle (the M. depressor palpebrae inferioris muscle) in the lower eyelid constricts the internal jugular vein, causing the blood pressure in the head to rise and rapidly forcing the blood from the sinus orbitalis into the nictating membrane, which covers most of the surface of the eyeball and is the site for the discharge of nearly all the veins from the anterior portion of the head. This rapid increase in blood pressure causes the nictating membrane to rupture, allowing the blood to escape. 
To watch an awesome video clip of a horned lizard's blood-squirting defense in action, follow the link below! It starts off a little slowly (you have to watch a short commercial featuring Ellen DeGeneres) but it is worth it!