Backward stochastic differential equations and optimal control of marked point processes