How can I get the tourism bonus for having the same religion as another civilization?

Each city can have followers of multiple religions; the city's "majority religion" -- the one whose icon shows up next to the city's name -- is determined by which religion has the most followers in said city (assuming they meet a certain minimum threshold related to city population).

In the exact same way, your civilization as a whole will have followers of multiple religions, and one of those will be the majority -- namely, the religion that has the most followers in your civilization. Multiple civilizations can therefore have the same majority religion (i.e. they each have more followers of that religion than any other), and that's what that Tourism bonus is based on.