The congruence extension property (CEP) is characterized in the paper by a lattice identity: an algebra $\mathcal A$ has the CEP if and only if the diagonal relation and an arbitrary congruence form a modular pair in the lattice of weak congruences of $\mathcal A$. It is know that in the lattice of a finite length, the semimodularity can be characterized by modular pairs. It is shown in the paper that the CEP is one of the sufficient conditions under which the lattice of weak congruences of an algebra is semimodular. Another sufficient condition is the weak congruence intersection property, the wCIP. Necessary conditions for the semimodularity of that lattice are also given. Two particular cases are considered: if $\mathcal A$ is a lattice, and if $\mathcal A$ is a unary algebra. In both cases, necessary and sufficient conditions for the semimodularity of a weak congruence lattice are formulated.