$f'\left(x\right)=2\,cos\,2x-1$
$\Rightarrow f'\left(x\right)=0$
$\Rightarrow 2\,cos\,2x-1=0$
$\Rightarrow cos\,2x=\frac{1}{2}$
$\Rightarrow 2x=\frac{\pi}{3}, - \frac{\pi}{3}$
$\Rightarrow x=\frac{\pi}{6}, -\frac{\pi}{6}$
Now, $f'\left(-\frac{\pi}{2}\right)=\frac{\pi}{2}$,
$f'\left(\frac{\pi}{2}\right)=-\frac{\pi}{2}$
$f'\left(-\frac{\pi}{6}\right)=-\frac{\sqrt{3}}{2}+\frac{\pi}{6}$ and $f'\left(\frac{\pi}{6}\right)=\frac{\sqrt{3}}{2}-\frac{\pi}{6}$
Clearly $\frac{\sqrt{3}}{2}-\frac{\pi}{6}$ is the greatest value of $f\left(x\right)$ and its least value $=-\frac{\pi}{2}$.
Hence the reqd. difference
$=\frac{\sqrt{3}}{2}-\frac{\pi}{6}-\left(-\frac{\pi}{2}\right)=\frac{\sqrt{3}}{2}+\frac{\pi}{3}$