BeCl2 contains 2 bonding pairs of electrons which arrange themselves as far away as possible to minimise the electron repulsion between them, giving a bond angle of 180 degrees and a linear shape. H2O also has 2 bonding pairs of electrons, but also 2 lone pairs of electrons on the oxygen atom. Therefore the 4 pairs of electrons spread themselves out as far as possible to minimise electron repulsion, however the repulsion between 2 lone pairs is greater than between a bonding pair and a lone pair, so the 2 lone pairs of electrons squish together the 2 bonding pairs further together, reducing the bond angle from the normal tetrahedral 109.5 degrees to 104.5 degrees , giving a bent shape.