What causes pain in the muscle behind a (potential) basal cell skin cancer?

Inflammation. Inflammation is often the cause of pain. However, when associated with cancer, nerve involvement by tumor needs to be excluded. See your dermatologist.