The short answer is it's a valve that releases the brew pressure from the grouphead, allowing you to immediately remove the portafilter after an extraction.
Without this pressure release mechanism, you must wait a few minutes for the water under pressure to leech through the puck. Should you forget to wait, removing the portafilter results in a "portafilter sneeze." The result is hot coffee grounds spattered on the front of the espresso machine and the countertop; there's also a risk of scalding yourself. A three-way solenoid valve is a standard feature on most pump-driven high-end espresso machines.
Randy's pages cited above provide more detail, including a good explanation of why and how to keep the three-way valve clean by backflushing. What is backflushing?
and Why is backflushing important?
discuss these related topics.