You should google it, you can find some very informative articles there..
In short both bypass excess pressure away from the compressor side when the throttle closes to prevent turbo damage. When the turbo is making boost and then the throttle is suddenly closed the compressor will momentarily keep spinning at high speed and with the throttle closed this extra air has no where to go but back towards the comprssor (away from engine). Which trys to stall the compressor, whcih is very bad.
The bypass valve (BPV) or blowoff valve prevent compressor stall or damage by venting this pressure spike when the throttle closes.. they peerform the same function but achieve it thru slightly different means.
Bypass valves (BPV) are most common and almost always used on factory cars. The BPV is often integral to the turbo assembly (ours is). It functions by allowing the compressed air to recirculate back in front of the turbo (basically the ram pipe area) effectively preventing any more air to be compressor/boost until the throttle opens.
BPV are quieter, often more compact, do not mess with airflow sensors as much, since the air that the ecm sees stays in the intake it allows for easier ecm programming.
Blow off valves (BOV) just dump the pressure spike into the atmospher/engine bay. This results in a louder pssstt sound and most aftermarket BOVs are designed to enhance the sound. They are simpler and require less plumbing, louder, since they dump "measured" air out of the intake tract more specialized programming must be used to ensure proper air/fuell mixtures whenever it opens.
That's a basic run down, I recommend you do alil online searching for a more technical and concise explanation but I hope this helps in the meantime
-tyler