You can make an Automator Service like the following:
Here is a closer look at the AppleScript in this Service:
-- Reference: https://apple.stackexchange.com/questions/240446/how-to-enable-disable-grayscale -mode-in-accessibility-via-terminal-app
tell application "System Preferences"
launch
reveal anchor "Seeing_Display" of pane id "com.apple.preference.universalaccess"
end tell
tell application "System Events" to tell process "System Preferences"
delay 1
click checkbox "Use grayscale" of window "Accessibility"
end tell
tell application "System Preferences" to if it is running then quit
return
I saved the Automator Service with the name GrayScale. In System Preferences : Keyboard panel : Shortcuts : Services : General, I double-clicked the right-hand side of the GrayScale entry, and gave it the keyboard shortcut of control+G. This will appear under the Finder's Service menu.
Because this is using GUI scripting, you will immediately get two stacked messages: 1) That Automator has encountered an error in the service, and right behind it, and the real reason, is the following dialog:
Click the "Open System Preferences button, and you will be taken to the Security & Privacy panel : Accessibility. Check the Finder entry to grant it authority, and afterward your keyboard shortcut will toggle Grayscale as expected.