The microscopic property that helps determine whether or not two substances will dissolve with each other is polarity.
Polarity refers to the distribution of electrical charge over the atoms in a molecule. Substances with similar polarities tend to dissolve well in one another (for example, polar solvents like water dissolve polar solutes like salt), while substances with differing polarities generally do not mix well (for example, oil, which is nonpolar, does not dissolve in water).