ActionScript is the programming language that Flash uses to allow animators to manipulate items, data, and events that occur inside the Flash SWF.
With Flash, you can create and animate things in two ways (and they can be combined, these are not exclusive at all): through the visual interface (with keyframes, tweens, the circle and line tool), and through programming via ActionScript. For instance, when making a simple Snake game (where you eat fruit and can’t touch your snake body), you would make the art assets externally or in the Flash visual interface, but all the game logic and animation (the snake moving, getting longer when eating a piece of fruit, the distribution of the fruit itself) would be done in ActionScript. The entire game may actually be only a few frames long (one for the title screen, one for the game board and each level, one for the death screen) and all the work is done by the AS in the background.
The differences between the version of AS are used to designate what set of functions and capabilities are in each version number, just as with all other versioning systems. The exact differences between 2.0 and 3.0 are well discussed elsewhere. Here is one page that not only describes the difference but seems to be a great AS3 beginning course.
ActionScript has nothing to do with HTML whatsoever beyond the fact that they are both commonly accessed through an internet browser. AS does have the ability to read and write to databases, and may have the ability to take in URL variables via POST or GET, but in general HTML and AS do not regularly interact beyond you using HTML to insert the Flash SWF onto the page.