Why do you need a script for this task?
This can be achieved by starting UltraCompare, starting a text comparison session, comparing the two PDF files, and clicking on Diffs only item ≠ for showing only the differences. The Diffs only item is the second item on last but one ribbon tab Edit and is also in Main toolbar on using toolbar/menu mode. The default hotkey for this command is Ctrl+D. There are many GUI based methods to run such a PDF comparison showing only differences.
From Windows command line or from within a batch file use:
"%ProgramFiles%\IDM Computer Solutions\UltraCompare\uc.exe" -B -b -ne -t "First PDF File.pdf" "Second PDF File.pdf"
Note: The program files directory of UltraCompare can be different depending on selected directory during installation of UltraCompare.
This starts UltraCompare for PDF files text comparison (-t) with showing only the differences (-ne ... not equal) with ignoring differences caused by blank lines (-B) and spaces/tabs (-b).
It is possible to append -o "Output File.txt" to let UltraCompare write the differences into the specified output file and terminate itself. The output format is defined by current setting for Text report format as configured at Home - Settings - Backup & Save (ribbon mode) or Options - Configuration - Backup & Save (toolbar/menu mode). The text report format cannot specified via a command line option.
The available command line switches/options/parameters are documented in help of UltraCompare on page Command Line Options. This help page can be opened in UltraCompare by pressing key F1, selecting first tab Contents, clicking on [+] symbol left to Getting Started and clicking on contents list item Command Line Options.
Best regards from an UC/UE/UES for Windows user from Austria