Today, inverse treatment planning for intensity modulated proton therapy (IMPT) usually employs a constant relative biological effectiveness (RBE). In this paper, the potential clinical relevance of RBE variations for scanning techniques in IMPT is investigated, and a new strategy to include the RBE into the inverse planning process is presented. Three-dimensional RBE distributions are calculated based on a phenomenological model that describes the RBE as a function of dose, linear energy transfer (LET) and tissue type in the framework of the linear-quadratic model. This RBE model is integrated into the optimization loop of inverse planning by using a modified version of the standard quadratic objective function, where the physical dose is replaced by the biological effect. This system for "biological optimization" was implemented into a research version of the inverse planning software KonRad and allows the direct optimization of the product of RBE and physical dose. Several treatment plans for a prostate case are presented, which compare the biological with the conventional physical dose optimization for IMPT scanning techniques, in particular distal edge tracking (DET) and the full three-dimensional (3D) modulation of beam spots. Mainly due to their different LET distributions, the RBE effects for these two techniques are quite different: while the RBE distribution was more or less homogeneous in the planning target volume (PTV) for 3D modulation, considerable RBE variations within the PTV were observed for DET. These unfavorable effects could be compensated for by employing the new biological objective function, which led to a more homogeneous distribution of the product of RBE and physical dose in the PTV. The computation time increased by a factor of 2 compared to the optimization of the physical dose. In conclusion, the proposed method allows the simultaneous multifield optimization of the biological effect in a reasonable time, and is therefore well suited for studying the influence of a variable RBE in IMPT as well as for minimizing potentially adverse effects.