Joe,
I'm so glad you asked.
First, I must give a bit of history...
Prior to the infamous pine tar game in August 1983, the rules were quite different from what they are now. Back then, a bat with too much pine tar was considered an illegal bat, and using an illegal bat was considered an "illegally batted ball." Batter was declared out and ejected.
In sum, here's how the pine tar situation was ruled:
1.) If a bat had too much pine tar, it was illegal.
2.) Using an illegal bat was called an "illegally batted ball."
3.) Hitting an illegally batted ball resulted in the batter being declared out and ejected; the ball was dead; and runners returned to time of pitch bases, except that any other outs made on the play stood.
Pursuant to the above rules, the umpires had an easy decision: George Brett was to be declared out and ejected, etc. However, then American League President Lee MacPhail upheld the Royals' protest and let Brett's home run stand. MacPhail admitted the umpires were technically correct, but that they violated the "spirit of the rules." I'm not going to get into the discussion here about MacPhail's decision. Instead, I'll address the question you two posed above.
Following the pine tar incident and MacPhail decision, the rules were substantially changed.
An illegal bat is one that does not conform to the requirements of Rule 1.10. Essentially, an illegal bat is one that is not manufactured according to the proper specifications. In other words, it wasn't made correctly, whether intentionally or unintentionally. For example: It's too wide, too long, its cup is too deep, etc. Also, Rule 1.10©, a subsection of the main rule, now specifically and separately addresses the pine tar issue by referencing a bat that has too much gripping substance beyond its 18" legal limit.
An
altered bat is an entirely different animal. This is a bat that has been tampered with in order to improve the distance factor or cause an unusual reaction with the baseball. This is covered under Rule 6.06(d). Such bats include ones that are corked, coated with paraffin, grooved, nailed, etc.
Because this is considered cheating, something a bit more direct, its penalty is more severe: The batter is declared out and ejected; the ball is dead; and runners return to time of pitch bases, except any other outs made on the bases shall stand.
Interestingly, hitting an "illegally batted ball" now refers to a batter making contact with a ball--fair, foul, or foul tip--with one or both feet completely outside the batter's box. It no longer refers to the condition of the bat.
In sum...
Illegal bat = A manufacturer or design flaw; doesn't meet proper specs.
Altered bat = A bat that has been tampered with
The former is just tossed out of the game; the latter has severe penalties.
Hope this helps.