Berellium has an electron configuration of # 1s^2 2s^2
This configuration allows the electrons to move apart from each other. ( electrons repel each other) The electrons will move as far apart as possible which results in an 180 degree geometry.
Cl- Be - Cl
Oxygen has an electron configuration of
The three p orbitals are all at right angles to each other. ( x, y and z axis) One of the p orbitals is filled with two electrons. The other two orbitals with a single electron can form bonds initially at 90 degrees.
Because of election repulsion the initial 90 degree angle is deformed to about a 108 degree angle.