A new analytical method for quantifying brain activity from magnetoelectroencephalogram (MEG) and electroencephalogram (EEG) recordings during periodic light stimulation is proposed. It consists in estimating the phase clustering of harmonically related frequency components of a subject's MEG/EEG responses evoked by the light stimulation. The method was developed to test the hypothesis that changes in the dynamics of brain systems in the course of intermittent photic stimulation (IPS) may precede the transition to seizure activity in photosensitive patients. We assumed that such changes would be reflected in the phase of harmonic components of the evoked responses. Thus, we determined the phase clustering for different harmonic components of these MEG/EEG signals. We found that the patients who develop epileptiform discharges during IPS present an enhancement of the phase clustering index at the gamma frequency band, compared with that at the driving frequency. We introduce a quantity--relative phase clustering index (rPCI)--by means of which this enhancement can be quantified. We argue that this quantity reflects the degree of excitability of the underlying dynamical system and it can indicate presence of nonlinear dynamics. rPCI can be applied to detect transitions to epileptic seizure activity in patients with known sensitivity to IPS.