A slight variant of Fedor's answer: using a QZ (generalized Schur) factorization $A=QT_A Z, B = Q T_BZ$, you can make an orthogonal change of basis such that $A$ and $B$ are both upper triangular. Then $P$ and $Q$ are both upper triangular, too, and the eigenvalues of $P-Q$ are its diagonal elements $a_{ii}b_{jj} - b_{ii}a_{jj}$, $i,j=1,\dots,n$. This makes it evident that $n$ of them are zeros, and that the rest of the entries in the upper triangle, generically, is not.
(EDIT: note that this change of variables does not preserve eigenvalues, since $Q$ and $Z$ are different in general, but it does preserve the rank.)