Are general 3-to-1 or specific 2-to-1 ports better in Settlers of Catan?
Unfortunately, it depends.

After the initial layout you want to try to identify which resources will be scarce and dominate them.  At the same time you want to try to identify which resources will be plentiful and dominate them and position yourself for the related 2-1 port.

It's unusual that you will be able to accomplish all of that :)

Once the layout is down, and folks have placed their initial cities you can then work to determine if you will have significant extra of a commodity.  If so, see if you can angle towards the 2-1 port.  If not, the 3-1 can work out just fine.