Why Capacitors use as High Voltage protection 1

Snubber Circuit
Why Capacitors use as High Voltage protection 2