The concept of in-groups and out-groups that shapes Japanese culture at all levels.
Uchi & soto is the Japanese cultural concept that people can be (and are) sorted into one of two groups: your in-group (uchi) or your out-group (soto). Is the person you are interacting with part of your inner-circle? Based on which group someone is in dictates how you should behave.
Uchi (内) means “inside” – it’s the familiar, the home, the groups you belong to. Soto (外) means “outside” – it’s the unknown, strangers, foreigners, the groups you aren’t a part of. People in your family, your coworkers, can be thought of as part of your inner circle, your uchi. Non-family members however, or your boss, can be considered soto. To add more complexity, these categorizations are fluid. While your boss is ordinarily considered soto, if the two of you are meeting with a customer then you’re unified in representing the company and so your manager is now considered uchi while the customer is soto. When you get back to the office however your manager goes back to being soto.
People are constantly moving between social circles based on the situation, creating a shifting web of relationships. The status of who you are interacting with, whether they are uchi or soto, influences how you behave. Soto people are shown respect and honor. This is done using keigo (“respectful language”), sometimes gifts are given, and as you honor soto people you humble yourself and members of your uchi. Foreign tourists are very much soto and as such will probably receive very polite honorable treatment.
To some degree however this honoring comes with tatemae (建前, “a façade”). A person’s true feelings, their honne (本音) is reserved only for members of their uchi. So a tourist may receive great service but really getting to know people can be difficult.
We can see uchi & soto played out in architecture as well. Traditional home design has a wall surrounding the property. These walls serve more as mental barriers than physical ones. The walls form a line of demarcation between the uchi and the soto. Where the uchi and soto meet in the house is the genkan which is the entryway where you remove your outside shoes before putting on your inside slippers – physical separations to match the mental separations.