With most forum software, you have at least two options:
+ Manual moderation. If you verify every member before they can post, you'll catch almost all bots.
+ Captcha (image verification, etc.). Unfortunately, captchas used by most popular software have long been cracked by spammers. If you use less well known, third party captcha systems, you may decrease the odds it is cracked. We have written new captchas for some of our customer's forums which require knowledge specific to the forum topics to answer and that tends to stop all the bots.
Honestly, if your forum is a big enough target, nothing is going to stop the spammers short of manual account verification because spammers employ low-wage home workers and other human methods to break captchas.