$\int_0^{\pi/2}\log^2(\cos^2x)\mathrm{d}x=\frac{\pi^3}6+2\pi\log^2(2)$???
Let $$I(a)=\int_0^{\frac {\pi}{2}} (\cos^2 x)^a dx$$
Hence we need $I''(0)$.
Now recalling the definition of Beta function we get $$I(a)=\frac 12 B\left(a+\frac 12 ,\frac 12\right)=\frac {\sqrt {\pi}}{2}\frac {\Gamma\left(a+\frac 12\right)}{\Gamma(a+1)}$$
Hence we have $$I''(a) =\frac {\sqrt {\pi}}{2}\frac {\Gamma\left(a+\frac 12\right)}{\Gamma(a+1)}\left(\left[\psi^{(0)}\left(a+\frac 12 \right)-\psi^{(0)}(a+1)\right]^2 +\psi^{(1)}\left(a+\frac 12 \right)-\psi^{(1)}(a+1)\right) $$
Substituting $a=0$ in above formula yields the answer.
Differentiation of the Beta function is a viable approach, but since we are dealing with a squared logarithm and not higher powers, it is faster to just exploit the Fourier (cosine) series of $\log(\cos^2\theta)$ and Parseval's theorem. Given
$$-\log(\cos^2\theta)=2\log 2+2\sum_{k\geq 1}\frac{(-1)^k}{k}\cos(2k\theta),\tag{1} $$ since $\int_{0}^{\pi/2}\cos(2jx)\cos(2kx)\,dx =\frac{\pi}{4}\delta(j,k)$, we immediately have $$ \int_{0}^{\pi/2}\log^2(\cos^2\theta)\,d\theta = 2\pi\log^2 2+\pi\zeta(2).\tag{2}$$
Since the LHS equals $\int_{0}^{1}\frac{4\log^2 x}{\sqrt{1-x^2}}\,dx$, we have just found the value of the hypergeometric series $$ 8\sum_{n\geq 0}\frac{\binom{2n}{n}}{4^n(2n+1)^3}=8\cdot\phantom{}_4 F_3\left(\tfrac{1}{2},\tfrac{1}{2},\tfrac{1}{2},\tfrac{1}{2};\tfrac{3}{2},\tfrac{3}{2},\tfrac{3}{2};1\right)\tag{3} $$ which also equals $\int_{0}^{+\infty}\frac{\log^2(1+t^2)}{1+t^2}\,dt$ or $\frac{1}{2}\int_{0}^{1}\frac{\log^2(x)}{\sqrt{x(1-x)}}\,dx$.
\begin{align}J=\int_0^{\frac{\pi}{2}} \ln^2\left(\cos x\right)\,dx\end{align}
Observe that,
\begin{align}I&=4J\\ J&=\int_0^{\frac{\pi}{2}} \ln^2\left(\sin x\right)\,dx\\ \int_0^{\frac{\pi}{2}} \ln\left(\sin x\right)\,dx&=\int_0^{\frac{\pi}{2}} \ln\left(\cos x\right)\,dx \end{align}
(change of variable $y=\dfrac{\pi}{2}-x$ )
\begin{align} K&=\int_0^{\frac{\pi}{2}} \ln^2 \left(2\sin x\cos x\right)\,dx\\ &=\int_0^{\frac{\pi}{2}} \ln^2 \left(\sin\left(2x\right)\right)\,dx\\ \end{align}
Perform the change of variable $y=2x$,
\begin{align} K&=\frac{1}{2}\int_0^{\pi} \ln^2 \left(\sin x\right)\,dx\\ &=\frac{1}{2}\int_0^{\frac{\pi}{2}} \ln^2 \left(\sin x\right)\,dx+\frac{1}{2}\int_{\frac{\pi}{2}}^\pi \ln^2 \left(\sin x\right)\,dx\\ \end{align}
In the latter integral perform the change of variable $y=\dfrac{\pi}{2}-x$ and recall $\sin\left(\pi-x\right)=\sin x$ for $x$ real,
\begin{align} K&=\int_0^{\frac{\pi}{2}} \ln^2 \left(\sin x\right)\,dx\\ &=\int_0^{\frac{\pi}{2}} \ln^2 \left(\cos x\right)\,dx\\ &=J \end{align}
On the other hand,
\begin{align} K&=\int_0^{\frac{\pi}{2}}\left(\ln 2+\ln(\sin x)+\ln(\cos x)\right)^2 \,dx\\ &=\frac{\pi}{2}\ln^2 2+\int_0^{\frac{\pi}{2}}\ln^2(\sin x)\,dx+\int_0^{\frac{\pi}{2}}\ln^2(\cos x)\,dx+2\ln 2\int_0^{\frac{\pi}{2}}\ln(\cos x)\,dx+\\ &2\ln 2\int_0^{\frac{\pi}{2}}\ln(\sin x)\,dx+2\int_0^{\frac{\pi}{2}}\ln(\sin x)\ln(\cos x)\,dx\\ &=\frac{\pi}{2}\ln^2 2+2J+4\ln 2\int_0^{\frac{\pi}{2}}\ln(\cos x)\,dx+2\int_0^{\frac{\pi}{2}}\ln(\sin x)\ln(\cos x)\,dx\\ \end{align}
\begin{align}L&=\int_0^\infty \frac{\ln^2 x}{1+x^2}\,dx\end{align}
Perform the change of variable $x=\tan y$,
\begin{align}L&=\int_0^{\frac{\pi}{2}} \ln^2\left(\tan x\right)\,dx\\ &=\int_0^{\frac{\pi}{2}}\left(\ln\left(\sin x\right)-\ln\left(\cos x\right)\right)^2\,dx\\ &=2J-2\int_0^{\frac{\pi}{2}}\ln(\sin x)\ln(\cos x)\,dx\\ \end{align}
Therefore,
\begin{align}K+L&=\frac{\pi}{2}\ln^2 2+4J+4\ln 2\int_0^{\frac{\pi}{2}}\ln(\cos x)\,dx \end{align}
Therefore (recall $K=J$),
\begin{align}J&=\frac{1}{3}L-\frac{\pi}{6}\ln^2 2-\frac{4}{3}\ln 2\int_0^{\frac{\pi}{2}}\ln(\cos x)\,dx\end{align}
On the other hand,
\begin{align}L&=\int_0^1 \frac{\ln^2 x}{1+x}\,dx+\int_1^\infty \frac{\ln^2 x}{1+x}\,dx\end{align}
In the latter integral perform the change of variable $y=\dfrac{1}{x}$,
\begin{align}L&=2\int_0^1 \frac{\ln^2 x}{1+x}\,dx\end{align}
But it is well known that,
\begin{align}\int_0^1 \frac{\ln^2 x}{1+x^2}\,dx&=\frac{\pi^3}{16}\\ \int_0^{\frac{\pi}{2}}\ln(\cos x)\,dx&=-\frac{1}{2}\pi\ln 2 \end{align}
Therefore,
\begin{align}J&=\frac{\pi^3}{24}-\frac{\pi}{6}\ln^2 2-\frac{4}{3}\ln 2\times -\frac{1}{2}\pi\ln 2\\ &=\boxed{\frac{\pi^3}{24}+\frac{1}{2}\pi\ln^2 2}\\ \end{align}
PS: See: https://math.stackexchange.com/a/2942594/186817
(in this post i assume only the value of $\zeta(4)$ )