隔山观虎斗is an idiom. Its literal meaning is watching the tigers fighting on the nearby hill. We also say坐山观虎斗, whose meaning is the same.
Tigers usually represent competitive powers. So imagine this scene: Your rivalries are fighting. You are just watching at a safe place—probably with a grinning face. You are not trying to intervene or mediate between them. You are waiting to gain an advantage when they are both exhausted and even injured.