Assume both $A'A$ and $B'B$ are invertible (the other cases are trivial).
The standard argument goes as follows: Let $M=B'A(A'A)^{-1}A'B$ and $N=B'(I-A(A'A)^{-1}A')B$. Then it is easy to check that $M$ and $N$ are positive definite and that the Cauchy-Schwarz inequality is equivalent to the following (true) inequality $$|M+N| \ge |M|$$which has equality if and only if $N$ is the zero matrix, i.e., when $(I-A(A'A)^{-1}A')B=0$, or $B=AC$ where $C=(A'A)^{-1}A'B$. This shows that your inequality is an equality if and only if $B=AC$ where $C$ is invertible.
Assume both $A'A$ and $B'B$ are invertible (the other cases are trivial). Let $M=B'A(A'A)^{-1}A'B$ and $N=B'(I-A(A'A)^{-1}A')B$. Then it is easy to check that $M$ and $N$ are positive definite and that the Cauchy-Schwarz inequality is equivalent to the following (true) inequality $$|M+N| \ge |M|$$which has equality if and only if $N$ is the zero matrix, i.e., when $(I-A(A'A)^{-1}A')B=0$, or $B=AC$ where $C=(A'A)^{-1}A'B$. This shows that your inequality is an equality if and only if $B=AC$ where $C$ is invertible.