Phase shift to inject reactive power.

You are right, my previous statement was wrong.

~~V difference injects Q, and phase difference injects P.~~

As we know from power flow equation, Pij=Vi*Vj*Yij*cos(theta i-theta j), and Qij=Vi*Vj*Yij*sin(theta i-theta j). Here, Pij is power flowing form node i to node j, and Vi is node i voltage, Vj is node j voltage, theta i is node i phase, and theta j is node j phase. Yij is admittance between node i and node j.

To simplify, we can write the formulas as P=V*(V-delta V)*Y*cos(delta theta), Q=V*(V-delta V)*Yij*sin(delta theta). Here, V=Vi, delta V=Vi-Vj, delta theta=theta i-theta j. Do partial derivative, we have:

dP/d(delta V)=V*Y*cos(delta theta), dP/d(delta theta)=-V*Y*(V-delta V)*sin(delta theta), dQ/d(delta V)=V*Y*sin(delta theta), dQ/d(delta theta)=V*Y*(V-delta V)*cos(delta theta)

Since delta theta and delta V are all very small compared with V and theta (otherwise your inverter will burst into flame), so we can simplify the formula with approximation:

dP/d(delta V)=V*Y, dP/d(delta theta)=0, dQ/d(delta V)=0, dQ/d(delta theta)=V*V*Y

Therefore, V difference injects P, and theta difference injects Q.