If I remember correctly, the problem is Tvheadend does not treat the program as new if there is a previously-shown element. Also, because of the way that dates/times are ambiguously defined in the XMLTV DTD, sometimes you may end up with a previously-shown date that occurs after the program's air date.
This is compounded by XMLTV treating the "new" element as meaning "this program has been aired on a different channel, and this is the first time it is being aired on this channel". However, Tvheadend treats the new element as one might expect: this is the first broadcast of this program on this channel.
Over at the Tvheadend forums I've posted patches for both tv_grab_zz_sdjson and tv_grab_zz_sdjson_sqlite that fixes these issues. What I've done is suppressed the generation of the previously-shown element if that airing of the program is marked "new" in th schedule.
I also filed a bug report about this with the sqlite version of the grabber, but the author has indicated that he is not going to change it because he wishes to closely follow the XMLTV DTD. While I understand his perspective, it makes it difficult to use with Tvheadend.
The forum posting with my patches is here:
tv_grab_zz_sdjson patches. I also have an updated patch for the current version of the sqlite grabber that I have yet to post on that thread, but will do so later today.