Ok, let's take this set by step. This defines an alias, called cw, which outputs the results of an identifier called colwords. These two lines sort of go together, so I'll explain them both in one go. In our case we want our tokens to be words, and words are separated by spaces. In general, though, tokens can be anything, and they can be separated by anything - spaces, commas, semicolons, slashes, etc.
Variables can contain anything at all, even nothing.
If we've reached the end then we don't want to process this non-existent word, we want to finish up. The while command makes sure that we only process the commands between the curly brackets while we have a word to process. This actually starts building up the string we want to output. We've got to put them back in, otherwise allthewordswillruntogether. However, I've discovered that mIRC doesn't like adding a space to the end of a string - they just don't get put there.