Here: length of pendulum $ =l $
maximum angular displacement $ =\theta $
mass of the bob $= m$
Now height of the bob at maximum angular displacement is
$ h=l-l\cos \theta =(1-\cos\theta ) $
Also at the end of the displacement kinetic energy of the bob = potential energy of the bob
$ =mgh=mgl\,(1-\cos \theta ) $