I was reading up on this today, so I'll have a stab at trying to explain what I've learned.
The aerodynamic centre of an airfoil (or an aircraft) is a useful concept when considering its pitch stability.
To be stable in pitch, an aircraft that is perturbed noseup from its trimmed angle of attack must, as a result of the increased angle of attack of wing and tailplane, develop a nosedown moment (and vice versa).
This is achieved by setting the tailplane at a lower aerodynamic angle of attack than the wing; the change in lift of the tailplane exerts a bigger change in moment (from going, say from 1 to 2 degrees AoA  a doubling of lift) than does the main wing (in going from say 3 to 4 degrees AoA  an increase in lift of 33%)
If you look at the centre of pressure of the two airfoils combined you can see that it therefore moves around as their angles of attack change together. This is somewhat unhelpful from an analytical point of view.
Even for a single cambered airfoil, the centre of pressure also moves around somewhat as the angle of attack changes.
If you're familiar with the idea of the coefficient of lift, then you should quickly understand the idea of the pitching moment coefficient. The pitching moment coefficient of a wing (or of two airfoils combined together in an aircraft) relates the twisting force exerted on the wing (or aircraft) to the dynamic pressure, the wing planform area and the chord. Because the pitching moment coefficient is related to a twisting force or torque, it must obviously change according to the point about which we choose to measure that torque. Therefore it is correct to talk about the pitching moment coefficient about a particular point. Also, in general, the twisting force varies with the angle of attack, even for constant dynamic pressure, planform, and chord. So, generally, the pitching moment coefficient is a function of AoA.
It turns out that if we measure the torque generated by the airfoil (or aircraft) about a carefully selected point, the pitching moment coefficient about that point becomes independent of the angle of attack. (In real life this is approximately "exactly" true only for a limited range of AoA, such as not in the stalled regime.)
That chosen point is defined as the aerodynamic centre of the wing (or aircraft).
If you imagine the twisting force of the wing (or aircraft) acting around that point, the torque it generates around that point becomes a function of airspeed alone (physical attributes like planform and chord remaining equal) through the dependence of the pitching moment on the dynamic pressure.
An analysis of the wing and tail configuration, in respect of their relative areas and angles of attack, principally) will tell you where the aerodynamic centre of the aircraft (in this case) is, and from there it's easy to spell out the criterion for positive pitch stability: the centre of mass of the aircraft must be ahead of the aerodynamic centre. Why? If the aircraft pitches nose up, it slows, the twisting moment holding up the nose decreases and the nose drops as a result. And vice versa. You no longer have to consider the change in twisting forces on the airplane caused purely by the change in AoA.
The aerodynamic centre of an aircraft is also called the neutral point. If the centre of mass is located at the neutral point the aircraft has neutral pitch stability. The distance between the centre of gravity and the neutral point is called the static margin. Depending on which way you define it, you can say that the requirement for positive pitch stability is that the static margin must be negative (usually that way around).
Quote:
When working with CP (center of pressure) and CG, the CP usally is aft of the CG. But on these illustrations, CG is between the wing AC and the tailplane AC, and they are both producing positive lift.

Many people incorrectly think that the CG must be ahead of the CP of the wing, and consequently the tail must to exert a downforce, for stability. That's not correct. In fact the CG can go all the way back to the neutral point which is some way behind the CP of the wing. The tail will then be lifting, as shown in your diagram. As the CG retreats rearward the AoA of the tailplane must increase to generate relatively more lift (by trimming). At the point when the AoA of the tailplane becomes equal to the AoA of the main wing the CG has reached the neutral point and the aircraft is neutrally stable. If the CG goes further rearward then the aircraft becomes unstable in pitch.
If you look in the POH for many aircraft the rear CofG limit is way way aft of the quarterchord point which is where the CP of the wing is, approximately. Clearly the tailplane is able to provide significant lift and still be stable.