What is the calculation behind Attack, Defense and Spellpower?
Every creature has a base Attack / Defense score.
When combat starts, your creatures get a bonus to Attack / Defense equal to your Hero's Attack / Defense scores.
If a creature's combined attack is greater than their target's defense, they take an additional 5% damage per point of difference, up to a cap of +300% damage (when attack is 60 greater than defense)
Conversely, if a creature's combined attack is less than their target's defense, they deal 2.5% less damage, down to 70% (when defense is 12 greater than attack).
Spellpower's exact effect varies depending on the spell. For instance, Magic Arrow does (10 * spell power) + 10 damage.
Haste has a constant effect and lasts Spell Power turns in duration.
About defense reduction in accepted answer: 70% is delta (coefficient 0.3), so defense-attack limit is 28 (not 12). If hero has offense / armor - it becomes more complicated: coefficients 1.1/1.2/1.3 for offender-damage (direct melee, not retaliation) and 0.95/0.90/0.85 armourer-received-damage (for basic/advanced/expert level).
For precise formula one sould also count offense/armor specialists (crack,gundula / tazar,neela,mephala). Same for archery, ballista, spells, specialists for them (and for creatures: galthran/shakti etc.), creature capabilities (there is champion's bonus, but not vs alebards; angels produce 50% more damage against devils etc.).
Unfortunatly on mightandmagic.wikia.com formula is incorrect (e.g. attack/deffense should be separated), more correct manual on russian-funsite: section "combat", search by "D(bas)" (maybe google-traslate could give comprehensable result).
Since game is somewhat popular there is also: damage-calculator. One could always check VCMI sources, but i'm not sure if it's 100% correspondce to homm3 system.