In radiotherapy with scanned particle beams, tissue heterogeneities lateral to the beam direction are problematic in two ways: they pose a challenge to dose calculation algorithms, and they lead to a high sensitivity to setup errors. In order to quantify and avoid these problems, a heterogeneity number H(i) as a method to quantify lateral tissue heterogeneities of single beam spot i is introduced. To evaluate this new concept, two kinds of potential errors were investigated for single beam spots: First, the dose calculation error has been obtained by comparing the dose distribution computed by a simple pencil beam algorithm to more accurate Monte Carlo simulations. The resulting error is clearly correlated with H(i). Second, the analysis of the sensitivity to setup errors of single beam spots also showed a dependence on H(i). From this data it is concluded that H(i) can be used as a criterion to assess the risks of a compromised delivered dose due to lateral tissue heterogeneities. Furthermore, a method how to incorporate this information into the inverse planning process for intensity modulated proton therapy is presented. By suppressing beam spots with a high value of H(i), the unfavorable impact of lateral tissue heterogeneities can be reduced, leading to treatment plans which are more robust to dose calculation errors of the pencil beam algorithm. Additional possibilities to use the information of H(i) are outlined in the discussion.