Again, sorry for this late reply of a post that I just became aware of today. The "filename.scan_start.scan_end.charge" is an old convention going back to my first SEQUEST .dta file days in the early/mid 90s. We used to sum MS/MS scans together which is why there are two scan numbers in that string. But these days, each MS/MS scan is searched and its scan number is reported in that string, repeated for "scan_start" and "scan_end". So whatever the scan number is for the MS/MS spectrum being searched, it gets reported to that string.
So this may bring up the question of where the scan numbers come from. And that gets a little convoluted with modern instruments and the different data formats that Comet takes as input. For example, with mzXML I believe the schema requires spectra to start at scan number 1 and be sequential. For mzML, I believe the scan number reported is the "scan" value in the spectrum "id" attribute of the "spectrum" element that is the reported scan number. And there's some fallback, likely the scan index (but 1-based) if the "scan" text isn't present. (And this could be all wrong but I don't have the energy to dig into the file parsing code right now to see what it does for the various formats and how it handles exceptions.) Anyways, let me know if you have any follow-up questions on this.