Question: what is the difference of capacitor and diode?
Answer: A diode only allows current to pass through it in one direction. A capacitor, in the context you've described, acts as a low impedance path to GND for high frequency signals. So a diode protects current from going in an unintended direction whereas a capacitor resists voltage (across it's plates) changing quickly.