It usually works by checking for a quick fade to black between the show and the commercial or something along those lines. I've seen VCRs that will edit them out of tapes you've recorded, and TiVo can do it in real time as it records. However, they took that feature out of the new TiVo models under pressure from the TV networks! I don't know why they're so terrified of losing advertising revenue from this (I doubt there are even *close* to 1 million TiVos out there, out of 100+ million TV households), but they are.
I don't know of anything that will do it in real time on an AIW (there may be such a program out there, but I've never heard it mentioned), but I believe there are editing programs that will take them out automatically in post-processing or as you convert to a compressed format.