The grain-size distribution and the character of individual grain boundaries in microcrystalline networks play a significant role in material properties, such as melting temperature, diffusion coefficients, resistivity, optical absorption, elastic constants, phase transformation pressure, and so on. In this study, the grain size of NaCl, SiO2 and FeC3 is controlled in situ at high pressures over the entire range of the length scale of crystallinity: single-crystal, micro-/nanocrystalline and amorphous materials within a volume commensurate with the size of the probing X-ray beam. The structure refinement of high-pressure samples from X-ray diffraction data can be significantly improved by controlling grain size by selecting the structure of starting materials and following certain high pressure-temperature-time paths.