We investigated an optical frequency comb generated by an InP-based semiconductor Mach-Zehnder (MZ) modulator by using a numerical model that takes into account the nonlinear change of a refractive index and an optical absorption induced by an applied voltage in the modulator. Such nonlinearities are negligible for conventional LiNbO3-based MZ modulators but not negligible for semiconductor MZ modulators. The numerical model quantitatively reproduced our experimental data reported previously. We found that the nonlinearities play an important role to obtain the flat 9-channel optical frequency comb block with an intensity deviation of less than 1 dB, when a moderate RF drive voltage of < 5 V was used. This result was sustained regardless of an RF drive voltage ratio between two arms in the MZ modulator.