I'm bored so I'll type this out. All of this is documented in the manuals.
Connect gw1 to the Internet on its WAN port. Configure its LAN port as 172.31.255.254/30. Add a route to 192.168.1.0/24 via 172.31.255.253.
Connect gw2 to the Internet on its WAN port. Configure its LAN port as 172.31.255.250/30. Add a route to 192.168.1.0/24 via 172.31.255.249.
Connect gw3 to the Internet on its WAN port. Configure its LAN port as 172.31.255.246/30. Add a route to 192.168.1.0/24 via 172.31.255.245.
Connect gw1's LAN port to ether1 on the RouterBOARD. Configure an IP address of 172.31.255.253 on ether1.
Connect gw2's LAN port to ether1 on the RouterBOARD. Configure an IP address of 172.31.255.249 on ether2.
Connect gw3's LAN port to ether1 on the RouterBOARD. Configure an IP address of 172.31.255.245 on ether3.
Connect your LAN switch to ether4 on the RouterBOARD. Configure an IP address of 192.168.1.1 on ether4.
/ip address
add address=172.31.255.253 interface=ether1
add address=172.31.255.249 interface=ether2
add address=172.31.255.245 interface=ether3
add address=192.168.1.1/24 interface=ether4
Configure policy routing mangle rules that mark traffic going from the LAN to the Internet based on the LAN host source address, these marks assign traffic to one of the three gateways.
/ip firewall address-list
add list=rfc1918 address=192.168.0.0/16
add list=rfc1918 address=172.16.0.0/12
add list=rfc1918 address=10.0.0.0/8
/ip firewall mangle
add chain=prerouting src-address-list=rfc1918 dst-address-list=rfc1918 action=accept
add chain=prerouting src-address=192.168.1.2-192.168.1.100 action=mark-routing new-routing-mark=to-gw1
add chain=prerouting src-address=192.168.1.101-192.168.1.200 action=mark-routing new-routing-mark=to-gw2
add chain=prerouting src-address=192.168.1.201-192.168.1.154 action=mark-routing new-routing-mark=to-gw3
/ip route
add dst-address=0.0.0.0/0 routing-mark=to-gw1 gateway=172.31.255.254
add dst-address=0.0.0.0/0 routing-mark=to-gw2 gateway=172.31.255.250
add dst-address=0.0.0.0/0 routing-mark=to-gw3 gateway=172.31.255.246
add dst-address=0.0.0.0/0 gateway=172.31.255.254 distance=1
add dst-address=0.0.0.0/0 gateway=172.31.255.250 distance=2
add dst-address=0.0.0.0/0 gateway=172.31.255.246 distance=3
If gw1-3 can't NAT networks not directly connected to them add NAT rules (though this will cause double NAT, which is fairly ugly):
/ip firewall nat
add chain=srcnat out-interface=ether1 action=src-nat to-address=172.31.255.253
add chain=srcnat out-interface=ether2 action=src-nat to-address=172.31.255.249
add chain=srcnat out-interface=ether3 action=src-nat to-address=172.31.255.245
Of course this doesn't cover things like DNS, or a DHCP server on the RouterBOARD. Those topics are fundamental and adequately covered by the manual.