The size of cosmic dust grains is in general given not by some size, but by a size distribution. The only direct measurements of such a distribution are made on dust collected on plates of satellites, which is of course a very local measurement. When we think that distributions look similar — though not exactly alike — in other locations of the Universe, so far away that we will never be able to go there, it is because we know how a given distribution and composition affects light traveling through an ensemble of dust grains.
A particle has a given probability of absorbing a photon with a given wavelength, and in general this probability peaks around wavelengths of the order of the size of the particle (for small particles). Thus, if we know how the spectrum of some light source looks if there were no dust around (and we do for many sources, e.g. stars), then the difference between the known intrinsic spectrum and the observed spectrum can be modeled assuming some distribution and composition. Often the composition needs not be assumed, but can be constrained from the emission of the dust at infrared wavelengths.
Usually, the model that fits best the observations is a steep power law of the form $P(r)\propto r^{-a}$ with an index of roughly $a\sim3.5$; that is, the probability of finding a small grain is much larger than the probability of finding a large grain (more precisely, for $a=3.5$, grains of size $r=x$ is $10^{3.5}\simeq3\,000$ times more common than grains of size $r=10x$, and $10^7\!$ more common than grains of size $r=100x$).
For very large grains, the probability of absorbing a photon becomes independent of the wavelength of the photon. Whereas the small grains as described above have a "color preference", large grains are said to be "gray". This is the case for boulders, rocks, pebbles, and even sand-grain-sized particles. Thus, if a cloud consisted of such particles, the spectrum of a background source would simply be diminished by a constant factor at all wavelengths. This is very rarely observed — rather the sources are diminished much more at the short wavelengths than at the long wavelengths, as expected if there are more small grains than large grains.