Context : The opacity due to grains in the envelope of a protoplanet \kappa _ { gr } regulates the accretion rate of gas during formation , meaning that the final bulk composition of planets with a primordial H/He envelope is a function of it . Observationally , for extrasolar planets with known mass and radius it is possible to estimate the bulk composition via internal structure models . Aims : We want to study the global effects of \kappa _ { gr } as a poorly known , but important quantity on synthetic planetary populations . Methods : We first determine the reduction factor of the ISM grain opacity f _ { opa } that leads to a gas accretion timescale consistent with grain evolution models for specific cases . In the second part we compare the mass-radius relationship of low-mass planets and the heavy element content of giant planets for different values of the reduction factor with observational constraints . Results : For f _ { opa } =1 ( full ISM opacity ) the synthetic super-Earth and Neptunian planets have too small radii ( i.e. , too low envelope masses ) compared to observations , because at such high opacity , they can not efficiently accrete H/He during the formation phase . At f _ { opa } =0.003 , the value calibrated with the grain evolution models , the synthetic and actual planets occupy a similar mass-radius domain . Another observable consequence is the metal enrichment of giant planets relative to the host star , Z _ { pl } / Z _ { star } . We find that the mean enrichment of giant planets as a function of mass M can be approximated as Z _ { pl } / Z _ { star } = \beta ( M / M _ { \textrm { \tiny \jupiter } } ) ^ { \alpha } both for synthetic and actual planets . The decrease of Z _ { pl } / Z _ { star } with mass follows \alpha \approx -0.7 independent of f _ { opa } in synthetic populations , in agreement with the value derived from observations ( -0.71 \pm 0.10 ) . The absolute enrichment level \beta decreases from 8.5 at f _ { opa } =1 to 3.5 at f _ { opa } = 0 . At f _ { opa } =0.003 , one finds \beta =7.2 which is similar to the result derived from observations ( 6.3 \pm 1 .0 ) . Conclusions : We find observational hints that the opacity in protoplanetary atmospheres is much smaller than in the ISM even if the specific value of \kappa _ { gr } can not be constrained in this first study as \kappa _ { gr } is found by scaling the ISM opacity . Our results for the enrichment of giant planets are also important to distinguish core accretion and gravitational instability . In the simplest picture of core accretion , where first a critical core forms , and afterwards only gas is added , \alpha \approx -1 . If a core accretes all planetesimals inside the feeding zone also during runaway gas accretion \alpha \approx -2/3 . The observational result ( -0.71 \pm 0.10 ) lies between these two values , pointing to core accretion as the likely formation mechanism .