dpi is a 1-form on T∗M and P is a smooth map P:TM→T∗M, so it makes sense to consider the pullback P∗dpi which is a 1-form on TM. Concretely, it just means express pi as a function of q and ˙q and then compute dpi as a function of dq and d˙q. An immediate application of the chain-rule gives the formula in the question.
This formula is quite relevant because it tells you that to recover ˙q from p (and in particular, to have P diffeomorphism, which is not always the case!), you need to be able to invert the matrix of components
∂2L∂˙qj∂˙qi.
If you can do it, you obtain an equivalence between the Lagrangian dynamics on TM and the Hamiltonian dynamics on T∗M. If you can't do it, then the Hamiltonian dynamics on T∗M is under-determined and the correct Hamiltonian dynamics equivalent to the original Lagrangian dynamics lives in general on a quotient of a submanifold of T∗M. It is exactly what happens in gauge theories.