Why a capacitor is connected between two ground terminals and what difference does it make?

enter image description here

Figure 1. The circuit has two grounds. The hollow ground symbol is used on the mains (live) side of the isolation. The solid ground symbol is used on the low-voltage DC side of the isolation.

To suppress the high frequency common mode is is necessary to put capacitors between the input and output side of the power supply with a capacitance substantially higher than the capacitance in the flyback transformer. This effectively shorts out the high frequency and prevents it escaping from the device. Source: What does the Y capacitor in a SMPS do?.

Links:

  • Safety Capacitors First: Class-X and Class-Y Capacitors.

The capacitor is for EMI filtering, it is there to reduce common mode noise.

Yes they are ground terminals. One is the ground reference for unisolated mains input side, the other one is the ground reference for isolated low voltage output side.

Therefore it must be of special type for safety reasons, the type is called an Y capacitor.