The definition of shan and beizi changed overtimes. Short answer: shan is an unlined inner-wear (can be worn on its own) while beizi is an outer wear (must be worn outside of something). Beizi in many situations refers to a formal jacket, especially when discussing about Song dynasty clothing. In those cases they are generally highly decorative (mostly the collar) and reaching at least the calf. Nowadays some people might wear beizi on its own without a shan, like wearing a blazer without a shirt, so confusion might arise. It is generally fine.