There probably isn't really any good way of distinguishing user edits from application edits, unless you know exactly what sort of changes the application might make and that users would not make similar changes, and if you're willing and able to write [Code] to detect the difference by reading the file contents.
You can, however, make it replace specific versions of older files, provided that you still have copies of these files yourself.  One example of how you might do so (this is just written on the spot; I haven't tested it):
[Files]
Source: SomeFile.xml; ...; Check: IsOverwritable('123456FEDCBA,ABD48291')
[Code]
function IsOverwritable(HashText: String): Boolean;
var
  Filename, Hash: String;
  Hashes: TStringList;
begin
  Filename := ExpandConstant(CurrentFileName);
  if not FileExists(Filename) then begin
    Result := True;
  end else begin
    Hash := GetMD5OfFile(Filename);
    Hashes := TStringList.Create();
    Hashes.CommaText := HashText;
    Result := Hashes.IndexOf(Hash) >= 0;
    Hashes.Free();
  end;
end;
After adding this, you should just need to replace the parameter used in the Check call with the comma-separated list of MD5 values (gathered eg. using md5sum) of all the possible versions of the file that were distributed by previous versions of the application that you wish to overwrite with your replacement version.
If the file does not exist, it will be installed.  If it does exist, and its hash value matches one of the ones specified, it will be overwritten.  Otherwise it will be left alone.
Note that there is a small chance that a file will be mistakenly overwritten due to having the same MD5 hash despite having different contents, as hashing can have collisions.  However the chances of this happening by accident are slim and you can usually get away with ignoring it.  (Another option is to use the SHA-1 hash instead of the MD5 hash; as this is longer there is a smaller chance of collision.)
comparetimestampflag (but you would have to rely on the target system clock and you would have to use a date time deep in the past). However, from[Code]section might be possible to store a list of those installed files with their hashes and in upgrade setup compare this file hash list with new file hashes before they would be overwritten. - TLama