In the Swiss travel pass, all transportation is included, so trains, busses, trams, metros, boats and even a few (but not all) rack railways and funiculars on mountains. Note that especially mountain trains around Grindelwald are not included (Validity map). But it is somewhat expensive, given its exhaustive coverage. If you are staying at a hotel or similar, your guest card provided by them might even contain local transit within the city so you would not need it at all. My recomodation is the Swiss Travel Pass Flex, which lets you select a few days for your transits but doesn’t cost as much.
Alternatively, you can go by buying single tickets or individual daypasses for the transit days. Your options are a regular ticket (‘point-to-point’ ticket) which is refundable and valid on all connections, a supersaver’s ticket (non-refundable) which is only valid on the connection you buy it for, and saver’s daypass which are non-refundable but also cover all trains in Switzerland on that day.
If you want to go for the individual tickets, there also is the Swiss half fare card which gives you a 50% discount on all tranportation tickets. There are also local daypasses for just one city with surroundings which are a lot cheaper than a daypass for all of Switzerland.
Not included in all passes are some funiculars and rack railways on mountains. For Lucerne and Interlaken, boats are not included in the city daypasses (but are in the Swiss travel pass and Saver’s daypasses).