If you go to System Preferences and click on Sharing, you can go to "Firewall" tab to do this.
Click on "New...", select whatever name you want (you'll probably want to select "other" and choose a new name), and then enter in the ports you need. Separate the ports by commas and dashes.
E.g. if you want ports 57, 98, 99, 100, 101, 102, and 163, then you would enter into the field "57, 98-102, 163"
BUT IF YOU'RE USING A ROUTER, then you'll need to enable to ports on the actual router as well.
Exactly how to do that will depend on the brand of your router, but you can most likely access your router's settings by opening up a web browser and going to the url "192.168.1.1"
There's no www. and there's no .com in it... it's an ip address.