What is Paul referring to when he says "scripture"? Is he referring to the torah?
The Hebrew word "Torah" refers to the first five books of the Bible:
Genesis, Exodus, Leviticus, Numbers, and Deuteronomy.
It was written by Moses, so it is called the "Five Books of Moses," or the "Book of the Law of Moses."
John 1:45 (ESV)
45 Philip found Nathanael and said to him, “We have found him of whom Moses in the Law and also the prophets wrote, Jesus of Nazareth, the son of Joseph.”
Joshua 8:30-31 (ESV)
30 At that time Joshua built an altar to the LORD, the God of Israel, on Mount Ebal,
31 just as Moses the servant of the LORD had commanded the people of Israel, as it is written in the Book of the Law of Moses, “an altar of uncut stones, upon which no man has wielded an iron tool.” And they offered on it burnt offerings to the LORD and sacrificed peace offerings.
Nehemiah 8:1 (ESV)
1 And all the people gathered as one man into the square before the Water Gate. And they told Ezra the scribe to bring the Book of the Law of Moses that the LORD had commanded Israel.
The Torah is the history of God’s dealings with mankind from creation to the death of Moses.
The Hebrew word "Torah" is translated into Greek as "Pentateuch," meaning "fivefold volume."
The "sacred writings" (hieros gramma) and "Scripture" (graphē) referred to by Paul in II Timothy 3:15-16 refers to more than just the Torah.
II Timothy 3:14-17 (ESV)
14 But as for you, continue in what you have learned and have firmly believed, knowing from whom you learned it
15 and how from childhood you have been acquainted with the sacred (hieros) writings (gramma), which are able to make you wise for salvation through faith in Christ Jesus.
16 All Scripture (graphē) is breathed out by God and profitable for teaching, for reproof, for correction, and for training in righteousness,
17 that the man of God may be complete, equipped for every good work.
"Scripture" also includes the Prophets and the Psalms, as seen in Luke 24:44-47.
Luke 24:44-47 (ESV)
44 Then he said to them, “These are my words that I spoke to you while I was still with you, that everything written about me in the Law of Moses and the Prophets and the Psalms must be fulfilled.”
45 Then he opened their minds to understand the Scriptures,
46 and said to them, “Thus it is written, that the Christ should suffer and on the third day rise from the dead,
47 and that repentance for the forgiveness of sins should be proclaimed in his name to all nations, beginning from Jerusalem.
Yeshua repeatedly referred to "the Law and the Prophets" during His ministry.
Matthew 5:17-19 (ESV)
17 “Do not think that I have come to abolish the Law or the Prophets; I have not come to abolish them but to fulfill them.
18 For truly, I say to you, until heaven and earth pass away, not an iota, not a dot, will pass from the Law until all is accomplished.
19 Therefore whoever relaxes one of the least of these commandments and teaches others to do the same will be called least in the kingdom of heaven, but whoever does them and teaches them will be called great in the kingdom of heaven.
Matthew 7:12 (ESV)
12 So whatever you wish that others would do to you, do also to them, for this is the Law and the Prophets.
Matthew 22:37-40 (ESV)
37 And he said to him, “You shall love the Lord your God with all your heart and with all your soul and with all your mind.
38 This is the great and first commandment.
39 And a second is like it: You shall love your neighbor as yourself.
40 On these two commandments depend all the Law and the Prophets.”
Since prophecy can be found in every book of the "Old Testament," the entire "Old Testament" can be included in what Yeshua referred to as "the Prophets."
Therefore, by this observation, "Scripture" can refer to all of the "Old Testament," or the "Tanakh" ("Tanach").
Yes. The "Holy Scripture" or "sacred writings" in v. 15 concerns the Torah
According to Thayers Greek Lexicon
c. τά ἱερά γράμματα the sacred writings (of the O. T.; (so Josephus, Antiquities prooem. § 3; 10, 10, 4 at the end; contra Apion 1, 10; Philo, de vit. Moys. 3, 39; de praem. et poen. § 14; leg. ad Gai. § 29, etc. — but always τά ἱερά γράμματα)): 2 Timothy 3:15 (here T WH omit; L Tr brackets τά); γράμμα equivalent to the written law of Moses, Romans 2:27; Μωϋσέως γράμματα, John 5:47. Since the Jews so clave to the letter of the law that it not only became to them a mere letter but also a hindrance to true religion, Paul calls it γράμμα in a disparaging sense, and contrasts it with τό πνεῦμα i. e. the divine Spirit, whether operative in the Mosaic law, Romans 2:29, or in the gospel, by which Christians are governed, Romans 7:6; 2 Corinthians 3:6f (but in 2 Corinthians 3:7 R G T WH read the plural written in letters, so L marginal reading Tr marginal reading).
On the other hand, 3:16, is intended to include all of the Hebrew scriptures:
a. a writing, thing written (from Sophocles down): πᾶσα γραφή every scripture namely, of the O. T., 2 Timothy 3:16; plural γραφαί ἅγιαι, holy scriptures, the sacred books (of the O. T.), Romans 1:2; προφητικαι, Romans 16:26; αἱ γραφαί τῶν προφητῶν, Matthew 26:56.
b. ἡ γραφή, the Scripture κατ' ἐξοχήν, the holy scripture (of the O. T.) — and used to denote either the book itself, or its contents (some would restrict the singular γραφή always to a particular passage
Since Paul was a Pharisee he would have accepted all three sections of the Hebrew Bible as inspired text: the Torah, the Prophets, and the Writings. The Sadducees (and the Samaritans) only accepted the Torah as inspired - the first five books.
Paul writes in Philippians 3:5:
circumcised on the eighth day, of the people of Israel, of the tribe of Benjamin, a Hebrew of Hebrews; in regard to the law, a Pharisee;
Additionally, we know that Timothy's mother is Jewish (Acts 16:1)
Paul came to Derbe and then to Lystra, where a disciple named Timothy lived, whose mother was Jewish and a believer but whose father was a Greek.
and it appears that from his infancy she (Eunice)- with help from her mother (Lois) - was faithful in teaching him (Timothy) the Torah.
I am reminded of your sincere faith, which first lived in your grandmother Lois and in your mother Eunice and, I am persuaded, now lives in you also. 2 Tim 1:5
It is important to remember the historical context of the time within which Paul is writing this personal letter to Timothy. There was no New Testament as we know it today. The "scriptures" that Paul used (and the Berean's searched) to prove Jesus was the Messiah are the Old Testament.