AP is basically a solid, near-homogenous material bullet. It can shatter or ricochet upon impact with thicker or sloped armour.
The additional softer cap (Capped) at the tip, will help dampen the initial impact shock and prevent the projectile from shattering, so it will hit the armour with full force at the point of impact. Ballistic cap will improve its aerodynamic and helps maintain its velocity to preserve kinetic energy for better penetration.
Solid penetrator (APCR/HVAP) have special material used on the projectile to keep them solid and prevent shape deformation during travel and upon impact, maintaining penetrating force at the tip of the shaped projectile.
These bullets above are like stone throwing, improvised.
The other thing is HEAT, it works like thondoror has explained. HEAT will detonate upon impact with a contact surface, either prematurely or precisely. Shooting this at a layered armour will greatly reduce its penetration capability, especially air pockets or ceramics or other heat-resistant plating sandwiched within.
The Germans installed skirts (as in Panzer IV ausf. H) to combat this weapon. Firing HEAT at skirts is futile, because it will detonate prematurely at the skirts, subjecting the hot molten metal projectile to atmospheric conditions between the skirt and the vehicle's hull, before actually drilling its way through the hull's armour.
http://en.wikipedia.org/wiki/Armor-piercing_shot_and_shell