It's not even that complicated - IRC hostmasks go like this:
nick!username@machine.domain.tld
you can use * as a wildcard to match any number of characters, or ? to match one character. so
/mode #cowchat +b *!*@3.1.33.7
bans any nick/user from the IP 3.1.33.7,
/mode #cowchat +b *!*@lame*.isp.com
bans anyone with a host that looks like lame<whatever>.isp.com - including
lame-1-2.isp.com
lame.1.north.isp.com
lamewoohoo.isp.com
but not:
lameisp.com
because there's no . before 'isp.com' as there is in the hostmask.
It's usually a good idea to ban people by host if they're on a dialup - you can usually tell by there being a bunch of numbers in the machine name, e.g. lame-3-1-33-7.dialup.isp.com. This prevents them from simply disconnecting, changing their username, and returning to the channel.
For more permanent bans, you'll want to use *!username@*.domain.tld. In this case, it's a good idea to use a * or ? at the front of the username if you include the username in the ban - many IRC servers will prepend a ~ to the username if they can't get a proper ident response from the client, so l33tk1d!~ejeet@feh-15-2.dialup.isp.com is probably the same dude as l33tk1d!ejeet@feh-15-2.dialup.isp.com, but banning *!ejeet@feh*.dialup.isp.com will *not* reliably keep out l33tk1d.
dig?