Optical spectroscopy techniques such as differential reflectance and transmittance have proven to be very powerful techniques to study 2D materials. However, a thorough description of the experimental setups needed to carry out these measurements is lacking in the literature. We describe a versatile optical microscope setup to carry out differential reflectance and transmittance spectroscopy in 2D materials with a lateral resolution of ~1 micron in the visible and near-infrared part of the spectrum. We demonstrate the potential of the presented setup to determine the number of layers of 2D materials and to characterize their fundamental optical properties such as excitonic resonances. We illustrate its performance by studying mechanically exfoliated and chemical vapor-deposited transition metal dichalcogenide samples.